<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!doctype html>
<html class="no-js">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>我的订单</title>
    <!-- Set render engine for 360 browser -->
    <meta name="renderer" content="webkit">
    <!-- No Baidu Siteapp-->
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <!-- Add to homescreen for Chrome on Android -->
    <meta name="mobile-web-app-capable" content="yes">
    <!-- Add to homescreen for Safari on iOS -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-title" content="Amaze UI"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/amazeui.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/app.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/index.css">
    <!--必要样式-->
    <style type="text/css">
        body {
            background-color: #EFEFEF;
        }

        .am-header-default {
            background-color: #ED6D00;
        }

        .storename {
            line-height: 55px;

            border-bottom: 1px solid #e6e6e6;
            padding: 0 20px;
        }

        .storename span {
            vertical-align: middle;
            display: inline-block;
            margin-left: 10px;
            font-size: 18px;
        }

        .storename .state1 {
            display: inline-block;
            float: right;
            font-size: 16px;
            color: #888;
        }

        .order {
            border-bottom: 3px solid #EFEFEF;
        }

        .order .b {
            padding: 10px 8px 10px 3px;
        }

        .order .b span {
            display: block;
            font-size: 18px;
            color: #333;
            line-height: 26px;
        }

        .state2 {

            display: inline-block;
            float: right;
            border-radius: 5px;
            margin-top: 16px;
            padding: 5px 10px;
            border: 1px solid #F7BD8B;
            color: #F7BD8B;
            line-height: 1em
        }
    </style>
</head>

<body>
<header data-am-widget="header" class="am-header am-header-default am-header-fixed">
    <div class="am-header-left am-header-nav">
        <a href="${pageContext.request.contextPath}/clientHome/userInfo" class="">
            <i class="am-header-icon am-icon-chevron-left"></i>
        </a>
    </div>
    <h1 class="am-header-title">
        <a href="#title-link" class="">
            商品订单
        </a>
    </h1>
</header>
<div id="orderlist">
    <div class="am-g whiteBg order" v-for="item in items">
        <a :href="'${pageContext.request.contextPath}/userGoodsOrder/detail?id='+item.id">
            <div class="am-u-sm-12 storename">
                <img src="${pageContext.request.contextPath}/images/store.png" alt="">
                <span v-if="item.type == 0">商品订单</span>
                <span v-if="item.type == 1">积分订单</span>

                <span v-if="item.statu == 11" class="state1">已完成</span>
                <span v-if="item.statu == 10" class="state2">评价</span>
                <span v-if="item.statu == 6" class="state2">催单</span>
                <span v-if="item.statu == 9" class="state2">确认收货</span>
            </div>
            <div class="am-u-sm-4" style="padding: 10px 8px">
                <img :src="item.shopMessage.shopImage" width="100%" alt="">
            </div>
            <div class="am-u-sm-8 b">
                <span style="font-size: 16px;">{{item.shopMessage.shopName}}</span>
                <span style="font-size: 10px;">{{item.createTime}}</span>
                <span style="color: #FF0000;">￥{{item.totalPrice}}</span>
            </div>
        </a>
    </div>
</div>

<!--[if (gte IE 9)|!(IE)]><!-->
<script src="${pageContext.request.contextPath}/assets/js/jquery.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/js/amazeui.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/js/vue.js"></script>
<script src="${pageContext.request.contextPath}/layer/layer.js"></script>
<script type="text/javascript">
    var orderlist = new Vue({
        el: "#orderlist",
        data: {
            items: []
        }
    });
    $(function () {


        $.ajax({
            type: "get",
            async: false,
            url: '${pageContext.request.contextPath}/userGoodsOrder/findAll',
            dataType: 'json',
            success: function (data) {

                if (data.success == true && data.code == 200) {
                    orderlist.items = data.obj;
                } else {
                    layer.msg(data.obj);
                }
            },
            error: function () {
                layer.msg('网络超时');
            }

        });

        $(".order").each(function () {
            var h = ($(this).find('.b').get(0).offsetHeight - 28) / 2;
            $(this).find('.l').css('marginTop', h);
            console.log(h);
        })

    });

</script>
</body>

</html>
